<?php
/**
 * Created by PhpStorm.
 * User: yiyu
 * Email: smalleasyu@gmail.com
 * Date: 2020-02-01 20:23:20
 * Desc: 微信小程序场景值表
 */

namespace app\base\model\miniProgram;

use think\Model;
use app\core\cache\RedisCache;

class MiniProgramScene extends Model
{
    protected $autoWriteTimestamp = false;

    protected $table = 'xy_mini_program.xy_mini_program_scene';

    public function __construct($data = [])
    {
        parent::__construct($data);
        RedisCache::selectDB(config('redis_db_index.wx'));
    }

    public static function getDataByScene($scene)
    {
        return self::where('scene', $scene)->find();
    }

    public static function addData($info)
    {
        return self::insert($info);
    }

    public static function updateData($scene, $info)
    {
        return self::where('scene', $scene)->update($info);
    }
}
